function [pw, xK, yK, sigmap,sigma, sigmah, psi] = ODE_noJump(w, p ,par)

investment = par.investment; investmentD = par.investmentD;
AL=par.AL; AH=par.AH;  sigmaK=par.sigmaK; rho=par.rho; N=par.N_w; 

psi = max( min(  (investment(p) + rho*p - AL)/(AH-AL),  1 ), 0 );
psi( w==0 ) = 0;   psi(w==1) = 1;  % Boundary condition

xK = (psi./w);  yK=(1-psi)./(1-w);

sigmap = sqrt( (AH-AL)./(p.*(xK-yK)) ) - sigmaK;   % Note: when we solve the ODE, because it will stop before reaching psi=1, we do not need to consider the case where households hold zero amount of productive capital. 
sigma = xK.*(sigmaK+sigmap);
sigmah = yK.*(sigmaK+sigmap);

pw =  max(0, sigmap./( w.*(1-w).*(xK-yK).*(sigmaK+sigmap) )) ;

% Deal with special cases at the boundaries
if (  ( numel(w)==1 && w==0 )  |  numel(w)>1 )    % Special case:  psi==0
    display( 'w=0 is evaluated in the ODE_noJump' );
    p0 = fsolve(  @(p)  investment(p) + rho*p - AL,  1 ,   optimoptions( 'fsolve','Display','none' ) );  % The initial condition
    d0 = (AH-AL)/( investmentD(p0) + rho ) * (  (AH-AL)/( p0*sigmaK )^2 * p0 + 1  );
    psi_w0 = (investmentD(p0) + rho)/ (AH-AL) * d0; 
    xK0 = psi_w0;  yK0 = 1;
    sigmap0 = 0;   sigmah0 = yK0*sigmaK; sigma0 = xK0*sigmaK;
    pw(w==0) = d0; xK(w==0)=xK0; yK(w==0)=yK0; sigmap(w==0) = sigmap0; sigma(w==0) = sigma0;  sigmah(w==0) = sigmah0;  psi(w==0)=0;
end
if (  ( numel(w)==1 && w==1 ) |   numel(w)>1  )  % Special case: psi==1
    p1 = fsolve(  @(p)  investment(p) + rho*p - AH,  1 ,   optimoptions( 'fsolve','Display','none' ) );  % The initial condition
    xK(w==1) = 1;       yK(w==1)=0;  
    pw(w==1) = 0;    
end

% For other outputs
if( nargout >1 )
    index = (psi>=0.999);   % This function allows vector evaluation
    pw(index) = 0;  % for psi=1, we should directly use the derivative of the price function at psi=1
    sigmap(index) = 0;
    sigma(index) = xK(index).*(sigmaK+sigmap(index)  );
    sigmah(index) = yK(index).*(sigmaK+sigmap(index) );
end



